package com.example.meterialproject.activitys.toolbars

import android.os.Bundle
import com.example.meterialproject.R
import com.example.meterialproject.base.BaseActivity
import com.example.meterialproject.databinding.ActivityToolbar02Binding
import com.example.meterialproject.exts.showSnack

/**
 *
 * @ClassName: Toolbar01Activity
 * @Author: android 超级兵
 * @CreateDate: 1/25/22$ 9:42 AM$
 * TODO
 */
class Toolbar02Activity : BaseActivity<ActivityToolbar02Binding>() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setSupportActionBar(binding.toolbar)

        binding.toolbar.setNavigationOnClickListener {
            it.showSnack("点击了navigation")
        }

        binding.toolbar.setOnMenuItemClickListener {
            when (it.itemId) {
                R.id.toolbar_menu_1,
                R.id.toolbar_menu_2,
                R.id.toolbar_menu_3,
                -> {
                    binding.toolbar.showSnack("点击了:${it.title}")
                    // 拦截 true
                    true
                }
                else -> {
                    false
                }
            }
        }
    }


}